package com.ruoyi.wallet.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.wallet.mapper.WalletMapper;
import com.ruoyi.wallet.domain.Wallet;
import com.ruoyi.wallet.service.IWalletService;

/**
 * 用户钱包Service业务层处理
 * 
 * @author 张富饶
 * @date 2025-05-20
 */
@Service
public class WalletServiceImpl implements IWalletService 
{
    @Autowired
    private WalletMapper walletMapper;

    /**
     * 查询用户钱包
     * 
     * @param id 用户钱包主键
     * @return 用户钱包
     */
    @Override
    public Wallet selectWalletById(Long id)
    {
        return walletMapper.selectWalletById(id);
    }

    /**
     * 查询用户钱包列表
     * 
     * @param wallet 用户钱包
     * @return 用户钱包
     */
    @Override
    public List<Wallet> selectWalletList(Wallet wallet)
    {
        return walletMapper.selectWalletList(wallet);
    }

    /**
     * 新增用户钱包
     * 
     * @param wallet 用户钱包
     * @return 结果
     */
    @Override
    public int insertWallet(Wallet wallet)
    {
        wallet.setCreateTime(DateUtils.getNowDate());
        return walletMapper.insertWallet(wallet);
    }

    /**
     * 修改用户钱包
     * 
     * @param wallet 用户钱包
     * @return 结果
     */
    @Override
    public int updateWallet(Wallet wallet)
    {
        wallet.setUpdateTime(DateUtils.getNowDate());
        return walletMapper.updateWallet(wallet);
    }

    /**
     * 批量删除用户钱包
     * 
     * @param ids 需要删除的用户钱包主键
     * @return 结果
     */
    @Override
    public int deleteWalletByIds(Long[] ids)
    {
        return walletMapper.deleteWalletByIds(ids);
    }

    /**
     * 删除用户钱包信息
     * 
     * @param id 用户钱包主键
     * @return 结果
     */
    @Override
    public int deleteWalletById(Long id)
    {
        return walletMapper.deleteWalletById(id);
    }
}
